using System;
using System.Collections.Generic;
using System.Text;

namespace My.IdlConverter.Core.Types
{
    public class TypeMap
    {
        public struct TypeSubstitution
        {
            public string Literal;
            public IType Type;
            public string ConvertorInMethod;
            public string ConvertorOutMethod;

            public TypeSubstitution(string literal, IType type,string convertorInMethod,string convertorOutMethod)
            {
                Literal = literal;
                Type = type;
                ConvertorInMethod = convertorInMethod;
                ConvertorOutMethod = convertorOutMethod;
            }

            public bool ContainConvertInMethod()
            {
                return (ConvertorInMethod.Length > 0);
            }

            public bool ContainConvertOutMethod()
            {
                return (ConvertorOutMethod.Length > 0);
            }
        }

        private string _origin;
        private IList<TypeSubstitution> _substitutionTypes = new List<TypeSubstitution>();

        public TypeMap(string orgin)
        {
            _origin = orgin;
        }

        public IList<TypeSubstitution> SubstitutionTypes
        {
            get
            {
                return _substitutionTypes;
            }
        }

        public string Origin
        {
            get
            {
                return _origin;
            }
        }
    }
}
